package com.cskaoyan.mall.dto;

import com.cskaoyan.mall.commons.exception.ValidateException;
import com.cskaoyan.mall.commons.result.AbstractRequest;

import com.cskaoyan.mall.constant.ShoppingRetCode;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.Map;

@Data
public class ClearCartItemRequest extends AbstractRequest {

    private Long userId;
    private Map<Long, Long> productIdAndNum;
    @Override
    public void requestCheck() {
        if (userId == null || CollectionUtils.isEmpty(productIdAndNum)) {
            throw new ValidateException(ShoppingRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(), ShoppingRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
    }
}
